<template>
  <div class="home">
    <section class="hero">
      <div class="hero-content">
        <h1>欢迎来到我的个人网站</h1>
        <p>我是前端开发者，专注于创造优秀的用户体验</p>
        <button class="cta-button" @click="scrollToFeatures">了解更多</button>
      </div>
      <div class="hero-image">
        <img src="https://picsum.photos/600/400?random=1" alt="Hero Image">
      </div>
    </section>

    <section class="features" ref="featuresSection">
      <h2>我的技能</h2>
      <div class="features-grid">
        <div class="feature-card">
          <div class="feature-icon">💻</div>
          <h3>前端开发</h3>
          <p>精通Vue、React等现代前端框架，能够构建响应式、高性能的Web应用。</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">🎨</div>
          <h3>UI/UX设计</h3>
          <p>注重用户体验，能够设计直观、美观的用户界面。</p>
        </div>
        <div class="feature-card">
          <div class="feature-icon">🚀</div>
          <h3>性能优化</h3>
          <p>擅长代码优化和性能调优，确保应用快速加载和流畅运行。</p>
        </div>
      </div>
    </section>

    <section class="stats">
      <div class="stats-grid">
        <div class="stat-item">
          <h3>50+</h3>
          <p>完成项目</p>
        </div>
        <div class="stat-item">
          <h3>5年</h3>
          <p>开发经验</p>
        </div>
        <div class="stat-item">
          <h3>100%</h3>
          <p>客户满意度</p>
        </div>
      </div>
    </section>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const featuresSection = ref(null)

const scrollToFeatures = () => {
  featuresSection.value.scrollIntoView({ behavior: 'smooth' })
}
</script>

<style scoped>
.home {
  max-width: 1200px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  padding: 4rem 2rem;
  min-height: 80vh;
}

.hero-content h1 {
  font-size: 3rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-content p {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 2rem;
}

.cta-button {
  background: #3498db;
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.cta-button:hover {
  background: #2980b9;
}

.hero-image img {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.features {
  padding: 4rem 2rem;
  background: white;
}

.features h2 {
  text-align: center;
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 3rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-card {
  text-align: center;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 10px;
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
}

.stats {
  padding: 4rem 2rem;
  background: #2c3e50;
  color: white;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: center;
}

.stat-item h3 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.stat-item p {
  font-size: 1.1rem;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 2rem 1rem;
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .features h2 {
    font-size: 2rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
}
</style>